package com.uw.tookit;

public class InformationPageData {
	
	private final String locationName;
	private final String description;
	private final int businessID;
	private final String category;
	private final int imageID;
	private final double latitude;
	private final double longitude;
	private final int good;
	private final int bad;


	/**
	 *	Create a new container 
	 * @param businessID the businessID for retrieving information from the
	 * 		server
	 * @param locationName the display name on the location
	 * @param description the location's description
	 * @param imageID the id from R.java
	 * @param category the category of this location
	 * @param latitude the latitude of the location
	 * @param longitude the longitude of the location
	 * @param good the number of good ratings this location has received
	 * @param bad the number of bad ratings this location has received
	 */
	public InformationPageData(int businessID, String locationName,
					String description, int imageID, String category,
					double latitude, double longitude, int good, int bad){
		this.businessID = businessID;
		this.locationName = locationName;
		this.description = description;
		this.imageID = imageID;
		this.category = category;
		this.latitude = latitude;
		this.longitude = longitude;
		this.good = good;
		this.bad = bad;
	}
	
	/**
	 * Gets the location name for the current lcoation
	 * @return The name of the location
	 */
	public String getLocationName() {
		return this.locationName;
	}
	
	/**
	 * The description for this location
	 * @return Description string
	 */
	public String getDescription() {
		return this.description;
	}
	/**
	 * The category for this location
	 * @return the category for this location
	 */
	public String getCategory() {
		return this.category;
	}

	/**
	 * Get the name of the image to be displayed for this location
	 * @return the image name to be passed to an imageview
	 */
	public int locationImageID() {
		return this.imageID;
	}
	/**
	 * gets the longitude of the this location
	 * @return the longitude as a string
	 */
	public double getLongitude() {
		return this.longitude;
	}
	/**
	 * Getter for the businessID
	 * @return the businessID as an int
	 */
	public int getBusinessID() {
		return this.businessID;
	}
	/**
	 * get the latitude of this location
	 * @return the latitude as a string
	 */
	public double getLatitude() {
		return this.latitude;
	}
	
	/**
	 * Accessor for the good ratings
	 * @return the number of good ratings as int
	 */
	public int getGoodRatings() {
		return this.good;
	}
	/**
	 * Accessor method for the bad ratings
	 * @return the number of bad ratings as int
	 */
	public int getBadRatings() {
		return this.bad;
	}
	/**
	 * Equality based on whether or not business ID's match
	 * 
	 * @param o the object you want to test for equality
	 * @return true if the objects have the same businessID, false otherwise.
	 */
	@Override
	public boolean equals(Object o) {
        /*
        * Added this in so I could add some extras later possibly (mainly 
        * caching system for less network usage).
        */
		// null case
		if(o == null)
			return false;
		// not the same type
		if(!(o instanceof InformationPageData)) 
			return false;
		else {
		    // check based on business ID
		    InformationPageData other = (InformationPageData)o;
		    return this.businessID == other.getBusinessID();
		}
	}
}
